/*
** malloc.h for  in /home/lund/Projets/malloc
** 
** Made by florian dewulf
** Login   <dewulf_f@epitech.net>
** 
** Started on  Fri Feb  1 13:29:48 2013 florian dewulf
** Last update Fri Feb  8 13:40:37 2013 florian dewulf
*/

#ifndef			__MALLOC_H__
#define			__MALLOC_H__

#include		<unistd.h>

typedef char		bool;

typedef struct		s_malloc {
  bool			state;
  struct s_malloc	*next;
  struct s_malloc	*prev;
  unsigned int		size;
}			t_malloc;

#define			TRUE	1
#define			FALSE	0
#define			ERROR	(void *)-1
#define			BLOCK	sizeof(t_malloc)

void			*malloc(size_t);
void			*realloc(void *, size_t);
void			free(void *);
void			show_alloc_mem();

void			*xsbrk(unsigned int);
t_malloc		*search_maille(void *);
void			*get_maille(t_malloc *, unsigned int);
unsigned int		get_size(unsigned int);
void			*separate(unsigned int);
void			*joint(t_malloc *);

void			*prev_equal(t_malloc *);
void			*next_equal(t_malloc *);
void			*prev_split(t_malloc *, t_malloc *, unsigned int);
void			*next_split(t_malloc *, t_malloc *, unsigned int);
void			*where_maille(t_malloc *, unsigned int);
void			*alloc(t_malloc *, unsigned int);

void			*tool_where(t_malloc *, unsigned int);

#endif
